With continuous development of computer technologies, the blockchain technology, which is a new distributed data storage technology, becomes increasingly popular because data stored in a blockchain is credible, as tamper-resistance is a feature of the blockchain technology (which can also be referred to as a distributed ledger technology).
A principle of data storage in the blockchain can be understood as follows: A user initiates a service request by using an Ethereum client (namely, a client that supports the blockchain technology, which can also be referred to as a blockchain client). The Ethereum client can send the service request to a consensus network. Each blockchain node in the consensus network performs a consensus procedure on the service request. Each blockchain node in the consensus network stores a data digest of the service request in a blockchain corresponding to each blockchain node after achieving a consensus on the service request. In addition, the Ethereum client can store, based on a predetermined data storage format specified in a smart contract, service data in the service request in a storage medium corresponding to the Ethereum client.
To subsequently help query data stored in the storage medium, an index is usually created in a predetermined way, so that the user can perform, by using the index, a query operation on the service data stored in the storage medium.
However, in practice, once a query condition used for querying the service data is different from the created index (in other words, the query condition does not match an index specified in the smart contract), data query efficiency is relatively low, or the query fails.